The accessibility of virtual methods indicates the permission of who can call which virtual method in a programming language. The override-ability of virtual methods indicates a permission upon who can override or redefine which virtual methods in a programming language. These concepts are sometimes considered orthogonal. For example, in the Microsoft® (Redmond, Wash.) common language runtime™ (CLR), an implementation of the ECMA 335 standard for a common language infrastructure, accessibility and override-ability of virtual methods are treated as orthogonal. That is, a virtual method may be overwritten in a derived class, even if the method is not accessible or callable in that derived class if permissible by the program constraints.
Programming languages such as Component Pascal and C++ both require this behavior to implement the semantics of their language. These languages separate the concepts of accessibility and override-ability of virtual methods so that a virtual method can be overridden in a derived class even if it cannot be called (i.e. the virtual method is not accessible). Other languages such as C# and Java equate the concepts of accessibility and override-ability so that one may only override virtual methods that one may actually call.
Source languages have their own rules with respect to visibility and accessibility of members of types and, in particular, about virtual methods. In a multi-language environment, such as the Microsoft® CLR™ it is desirable that the semantics be preserved in the generated intermediate language, otherwise it would be possible to circumvent that language's semantics in other languages. For instance, in C# one cannot override virtual methods that are not accessible, but another language might allow this. If the intent of the C# semantics would not be captured in the intermediate language and enforced by the CLR™, it would be possible to override an inaccessible method in some other language.
Currently, there is no way that these languages can enforce their intended semantics to consumers of their assemblies, such as programmers. Thus, there is a need for mechanisms to enforce the intended semantics of program languages with respect to virtual methods in multi language environments. The present invention addresses the aforementioned needs and solves them by creating an identification field for semantic permissions identification and by testing for the condition to ensure proper enforcement.